'- 
'-  teste1_0108231230_msx2+_screen12_conv.txt
'- 010808 - primeira tentativa no firstbasic-dos
'- input= 256x424 
'- output= 2x 53k scx (sx0,sx1) files

finp$="picture.jpg"

dim pr[4],pg[4],pb[4],dt[4],py[4]
f2$=finp$+".a08":f3$=finp$+".b08"
xed=256:yed=424
setdisplay(xed,yed,32,1):paper(8^8-1):ink(0):pen(0):cls
loadimage(finp$,1):pasteicon(0,0,1)
open f2$ for output as #2:open f3$ for output as #3
for i=2 to 3:writebyte(i,254):next
for i=2 to 3:for j=1 to 3:writebyte(i,0):next:next
for i=2 to 3:writebyte(i,212):next
for i=2 to 3:for j=1 to 2:writebyte(i,0):next:next

for yp=0 to yed-1
  setcaption("line "+str$(yp)+"/423")
  for x=0 to xed-1
    c=point(x,yp)
    ri=bitwiseand((int(c/65536)),0xFF)
    gi=bitwiseand((int(c/256  )),0xFF)
    bi=bitwiseand(c,0xFF)
    ci=(bitwiseand(gi,224))+(bitwiseand(ri,224)/8)+(bitwiseand(bi,192)/64)

    if (yp mod 2)<1 then:
      writebyte(2,ci)
    else
      writebyte(3,ci)
      end if
    next:next

close #2:close #3

setcaption("done")

'100 SCREEN0:WIDTH40:SCREEN8,,,,,0:COLOR 1,15,0:CLS
'102 A$="DSC00878":VDP(10)=VDP(10) OR 12
'106 FOR I=0 TO 1:SET PAGE I,I:CLS:NEXT
'108 SET PAGE ,0:BLOAD A$+".A08",S
'110 SET PAGE ,1:BLOAD A$+".B08",S
'112 IF INKEY$<>CHR$(27) THEN GOTO 112
'114 VDP(10)=VDP(10) AND 243:STOP
'116 SAVE"AUTOEXEC.BAS",A


